package com.checkin.repository;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Repository;

import com.checkin.model.Person;

@Repository("personRepository")
public class PersonRepositoryImpl implements PersonRepository {

	@PersistenceContext
	private EntityManager em;
	
	public Person save(Person person) {
		if(person.getId()==null){
			em.persist(person);
			em.flush();
			System.out.println("Repositoryde Person Kaydedildi");
		}else{
			em.merge(person);
		}
		return person;
	}

	public List<Person> listAll() {
		// TODO Auto-generated method stub
		return null;
	}

}
